// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace gitiles autoescape="contextual"}

/**
 * HTML page for /.
 *
 * @param hostName host name.
 * @param? menuEntries menu entries.
 * @param baseUrl base URL for repositories.
 * @param repositories list of repository description maps with name, cloneUrl,
 *     and optional description values.
 */
{template .hostIndex}
{call .header}
  {param title: $hostName ? $hostName + ' Git repositories' : 'Git repositories' /}
  {param menuEntries: $menuEntries /}
  {param breadcrumbs: null /}
{/call}

{if length($repositories)}

  <h2>
    {msg desc="Git repositories available on the host"}
      {$hostName} Git repositories
    {/msg}
  </h2>

  <div class="instructions">
    {msg desc="description on how to use this repository"}
    To clone one of these repositories, install{sp}
    <a href="http://www.git-scm.com/">git</a>, and run:
    <pre>git clone {$baseUrl}<em>name</em></pre>
    {/msg}
  </div>

  <table class="list">
    <tr class="no-hover">
      <th width="25%">
        {msg desc="column header for repository name"}
          Name
        {/msg}
      </th>
      <th>
        {msg desc="column header for repository description"}
          Description
        {/msg}
      </th>
    </tr>
    {foreach $repo in $repositories}
      <tr>
        <td>
          <a href="{$repo.url}">{$repo.name}</a>
        </td>
        <td>{$repo.description}</td>
      </tr>
    {/foreach}
  </table>
  <div class="footer">
    <a href="?format=TEXT">{msg desc="text format"}TXT{/msg}</a>
    {sp}
    <a href="?format=JSON">{msg desc="JSON format"}JSON{/msg}</a>
  </div>
{/if}
{call .footer /}
{/template}
